total_price_temp = 0
flag = True
while flag:
    price_str = input('请输入商品单价:')
    price = float(price_str)
    count = int(input('请输入商品数量:'))
    buy_over = input('是否购物结束,1代表结束,0 代表不结束')
    total_price_temp = total_price_temp + price * count
    print('应付总额:', total_price_temp)
    if buy_over == '1':
        flag = False
    elif buy_over == '0':
        flag = True


# print('应付总额:', total_price_temp)
pay_way = input('请选择付款方式:1 代表现金付款,2 代表支付宝,3 代表刷卡支付')
if pay_way == '1':
    print('选择现金支付,现金没有折扣', '花掉 %.2f 元' % total_price_temp)
elif pay_way == '2':
    print('支付宝付款,返现 {}'.format(total_price_temp * 0.1), '实际付款' + str(total_price_temp * 0.9))
elif pay_way == '3':
    print('刷卡支付')
    if total_price_temp > 100:
        total_price_temp = total_price_temp - 20
        print('实际付款:', total_price_temp)
    else:
        print('实际付款:', total_price_temp)
else:
    print('没有这种付款方式!')
